package com.gljx.web.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.gljx.web.Entity.TrainChargeParament;
import com.gljx.web.dao.TrainChargeParamentMapper;
import com.gljx.web.service.TrainChargeParamentService;

@Transactional
@Service
public class TrainChargeParamentServiceImpl implements TrainChargeParamentService{

	@Autowired
	private TrainChargeParamentMapper trainChargeParamentMapper;
	
	@Override
	public List<TrainChargeParament> queryTrainChargeParamentByCompangId(String companyId) {
		// TODO Auto-generated method stub
		return trainChargeParamentMapper.selectTrainChargeParamentByCompangId(companyId);
	}

	@Override
	public List<TrainChargeParament> selectTrainChargeParamentByCompangIdAndName(String companyId, String fnameL2) {
		// TODO Auto-generated method stub
		Map<String, String> map = new HashMap<>();
		map.put("companyId", companyId);
		map.put("fnameL2", fnameL2);
		return trainChargeParamentMapper.selectTrainChargeParamentByCompangIdAndName(map);
	}

	@Override
	public void add(TrainChargeParament trainChargeParamentr) {
		// TODO Auto-generated method stub
		trainChargeParamentMapper.insertSelective(trainChargeParamentr);
	}

	@Override
	public void modify(TrainChargeParament trainChargeParamentr) {
		// TODO Auto-generated method stub
		trainChargeParamentMapper.updateByPrimaryKeySelective(trainChargeParamentr);
	}

	@Override
	public TrainChargeParament queryTrainChargeParamentByFid(String fid) {
		// TODO Auto-generated method stub
		return trainChargeParamentMapper.selectByPrimaryKey(fid);
	}

	@Override
	public void deleteByFid(String[] deleteId, String fid) {
		// TODO Auto-generated method stub
		if(fid == null || "".equals(fid)){
			for (int i = 0; i < deleteId.length; i++) {
				trainChargeParamentMapper.deleteByPrimaryKey(deleteId[i]);
			}
		}else{
			trainChargeParamentMapper.deleteByPrimaryKey(fid);
		}
	}

}
